package cn.hansfly.puzzle;


class WithFinals {
	private final void f() {
		System.out.println("WithFinals.f()");
	}
	
	public void g() {
		System.out.println("WithFinals.g()");
	}
}

class OverridingPrivate extends WithFinals {
	private final void f() {
		System.out.println("OverridingPrivate.f()");
	}
	
	public void g() {
		System.out.println("OverrindingPrivate.g()");
	}
}

class OverridingPrivate2 extends OverridingPrivate {
	public final void f() {
		System.out.println("OverridingPrivate2.f()");
	}
	
	public void g() {
		System.out.println("OverringPrivate2.g()");
	}
}

public class FinalOverridingIllusion {
	public static void main(String[] args) {
		OverridingPrivate2 op2= new OverridingPrivate2();
		
		op2.f();
		op2.g();
		
		OverridingPrivate op1 = op2;
		
		op1.g();
		
		WithFinals wf = op2;
		wf.g();
		
	}
}
